define(["jquery","bbcare","fu/app/comm/comm"],function($,$bb,$comm){
	var servers = {};
	var URL = $bb.baseUrl("followapp");

	/* 查询 访视问卷 */
	servers.getQuestiones = function(params,callback){
		$bb.ajax({
			url: URL + "ctrl/patientRecord/qryPatientRecordTempl",
			data:JSON.stringify({
				data : {
					"paramCode":"B0102"
				}
			}),
			success: function(data){
				if(data.success){
					callback(data.data,params);
				}else{
					$bb.toastShow(data.msg ? data.msg : "查询访视问卷出错！");
				}	
			}
		});
	}

	/* 访视记录的新增 修改 */
	servers.ajaxSubmitPatientRecord = function(params,callback){
		$bb.ajax({
			url: URL + "ctrl/patientRecord/submitPatientRecord",
			data:JSON.stringify({
				data : params
			}),
			success: function(data){
				if(data.success){
					callback(data.data);
				}else{
					$bb.toastShow(data.msg ? data.msg : "访视记录的新增修改出错！");
				}	
			}
		});
	}

	/* 获取答案 */
	servers.ajaxPatientRecord = function(callback,questions,params){
		$bb.ajax({
			url: URL + "ctrl/patientRecord/qryPatientRecordById",
			data:JSON.stringify({
				data : {
					"id":params.info.id
				}
			}),
			success: function(data){
				if(data.success){
					callback(data.data,questions,params);
				}else{
					$bb.toastShow(data.msg ? data.msg : "获取答案出错！");
				}	
			}
		});
	}

	return servers;
});